It's not "illegal" to have someone ride on your bike with you, but it's dangerous. The police officer was just looking out for safety. He couldn't fine or ticket you for it.
*Edit*
Found this post in another forum:
"in the US, as far as i know there is no federal law, so set by individual state law --- so varies by state -- but most states have laws something like "bike must have a seat for each rider" or something similar often with special specifications of what designates a seat with special attention given to child seats... some states also specifically prohibit more than one rider on a bike designed for 1 person or specifically prohibit riding on handlebars or whatever
that said, i sometimes use my rear-rack and extra long rear-skewer for my trailer as footpegs to transport a passenger... i suppose depending on your interpretation the rear rack COULD be argued to be a "seat"... i've never been stopped by the police. i also see 2 on a bike relatively often in Munich, but that doesn't mean it's legal (wrong-way cycling is also common and illegal)
just guessing, but w/o a seating surface i would be surprized if it's not illegal... now if you built some kind of a rear rack with a pad that works as a seat, maybe it might be legal ? maybe someone here knows the actual law for Scottland."